<template>
    <div id="sunburstchart">
    <el-row>
      <el-col :span="6">
        <div id="sunburstData">
          <el-tree :data="data" :props="props" node-key="name" :default-expanded-keys="expanded" @node-click="handleNodeClick"></el-tree>
        </div>
      </el-col>
      <el-col :span="18">
        <div id="sunburst"></div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import {SunburstChart} from './SunBurstChart'
export default {
  data () {
    return {
      sunburstData: [],
      data: [],
      props: {
        children: 'children',
        label: 'name'
      },
      expanded: ['flare'],
      sunburstChart: ''
    }
  },
  created () {
    this.sunburstChart = new SunburstChart('sunburst')
  },
  mounted () {
    this.getData()
  },
  methods: {
    async getData () {
      let {data: res} = await this.$http.get('./static/data/sunburst.json')
      this.sunburstData = res
      this.data.push(res)
      this.sunburstChart.data = this.sunburstData
      this.sunburstChart.draw()
    },
    handleNodeClick () {}
  }
}
</script>
<style scoped>
   #sunburstchart {
       height: 100%;
       width: 100%;
   }
   #sunburstchart>.el-row {
       height: 100%;
   }
   #sunburstchart>.el-row>.el-col {
       height: 100%;
   }
   #sunburst {
       height: 100%;
       width: 100%;
   }
</style>
